package com.epk.pic.vo.base;

import lombok.Data;

import java.io.Serializable;

@Data
public class ApiResponse<T> implements Serializable {
    private int code;
    private String message;
    private T data;

    public ApiResponse(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static <T> ApiResponse<T> succ(T data) {
        return new ApiResponse<>(200, "成功", data);
    }

    public static ApiResponse<Void> succ() {
        return new ApiResponse<>(200, "成功", null);
    }

    public static <T> ApiResponse<T> err(String data) {
        return new ApiResponse<>(500, data, null);
    }

}
